import request from '@/utils/request'

export function getCrcCommit (parameter) {
  return request({
    url: '/v2/boss/project/apply/crc/commit',
    method: 'post',
    data: parameter
  })
}
export function getPmCommit (parameter) {
  return request({
    url: '/v2/boss/project/apply/pm/commit',
    method: 'post',
    data: parameter
  })
}
export function getlListAudit (parameter) {
  return request({
    url: '/boss/project/apply/wait/listAudit',
    method: 'get',
    params: parameter
  })
}
export function getListAuditComplete (parameter) {
  return request({
    url: '/boss/project/apply/process/listAudit',
    method: 'get',
    params: parameter
  })
}
export function getCostList (parameter) {
  return request({
    url: '/v2/boss/project/apply/list',
    method: 'get',
    params: parameter
  })
}
export function selectResearchProject (parameter) {
  return request({
    url: '/boss/project/apply/pm/listPro',
    method: 'get',
    params: parameter
  })
}
export function selectResearchCenter (parameter) {
  return request({
    url: '/v2/boss/project/apply/listSite',
    method: 'get',
    params: parameter
  })
}
export function selectResearchPerson (parameter) {
  return request({
    url: '/boss/project/apply/listResearch',
    method: 'get',
    params: parameter
  })
}
export function selectResearchAccount (parameter) {
  return request({
    url: '/boss/project/apply/listBankResearch',
    method: 'get',
    params: parameter
  })
}
export function selectSubjectProject (parameter) {
  return request({
    url: '/boss/project/apply/crc/listPro',
    method: 'get',
    params: parameter
  })
}
export function selectSubjectProjectV2 (parameter) {
  return request({
    url: 'v2/boss/project/apply/crc/listPro',
    method: 'get',
    params: parameter
  })
}
export function getRecords (parameter) {
  return request({
    url: 'v2/boss/project/apply/person/listProFeeApplyForPI',
    method: 'get',
    params: parameter
  })
}

export function selectSubjectCenter (parameter) {
  return request({
    url: '/v2/boss/project/apply/listSite',
    method: 'get',
    params: parameter
  })
}
export function selectSubjectPerson (parameter) {
  return request({
    url: '/v2/boss/project/apply/listPts',
    method: 'get',
    params: parameter
  })
}
export function selectSubjectAccount (parameter) {
  return request({
    url: '/boss/project/apply/listBankPts',
    method: 'get',
    params: parameter
  })
}
export function getVersionList (parameter) {
  return request({
    url: '/boss/project/visit/version/list',
    method: 'post',
    data: parameter
  })
}
export function getApplyDetail (parameter) {
  return request({
    url: '/v2/boss/project/apply/detail',
    method: 'get',
    params: parameter
  })
}
export function requestCostUrge (parameter) {
  return request({
    url: '/v2/boss/project/apply/urge',
    method: 'post',
    data: parameter
  })
}
export function getFlowInfo (parameter) {
  return request({
    url: '/v2/boss/approve/getFlowByResearchId',
    method: 'get',
    params: parameter
  })
}
export function feeApplyCommitForPI (parameter) {
  return request({
    url: '/v2/boss/project/apply/pm/feeApplyCommitForPI',
    method: 'post',
    data: parameter
  })
}
export function feeApplySaveDraft (parameter) {
  return request({
    url: '/boss/project/apply/draft/saveDraft',
    method: 'post',
    data: parameter
  })
}
export function feeApplyCommitForCRC (parameter) {
  return request({
    url: '/v2/boss/project/apply/crc/feeApplyCommitForCRC',
    method: 'post',
    data: parameter
  })
}
export function preCheckForCommit (parameter) {
  return request({
    url: '/v2/boss/project/apply/crc/preCheckForCommit',
    method: 'post',
    data: parameter
  })
}
export function listTeamUsers (parameter) {
  return request({
    url: '/boss/project/team/listTeamForActive',
    method: 'post',
    data: parameter
  })
}
export function listTeamForResearchNo (parameter) {
  return request({
    url: '/boss/project/team/listTeamForResearchNo',
    method: 'get',
    params: parameter
  })
}
export function listTeamForPtNo (parameter) {
  return request({
    url: '/boss/project/team/listTeamForPtNo',
    method: 'get',
    params: parameter
  })
}

/**
 * 获取所有中心
 * @param parameter
 * @return {*}
 */
export function apiGetAllCenter (parameter) {
  return request({
    url: '/boss/project/research/listAllSite',
    method: 'get',
    params: parameter
  })
}

/**
 * 费用申请 pdf 导出
 * @param parameter
 * @return {*}
 */
export function apiExpenseExport (parameter) {
  return request({
    url: '/v2/boss/project/apply/exportPDFForFeeApply',
    method: 'get',
    params: parameter,
    responseType: 'blob'
  })
}
/**
 * 获取费用申请草稿
 * @param parameter
 * @return {*}
 */
export function getDraftDetail (parameter) {
  return request({
    url: '/boss/project/apply/draft/getDraft',
    method: 'get',
    params: parameter
  })
}
/**
 * 获取费用申请详情，用于驳回时，重新回填数据
 * @param parameter
 * @return {*}
 */
export function getApplySubmitDetail (parameter) {
  return request({
    url: '/v2/boss/project/apply/resubmit',
    method: 'get',
    params: parameter
  })
}

/**
 * 费用申请脱敏上传
 * @param parameter
 * @return {*}
 */
export function apiMosaicUploadNew (parameter) {
  return request({
    url: '/common/mosaicUploadNew',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: parameter,
    timeout: 5 * 60 * 1000
  })
}

/**
 * 费用申请--上传医疗票据和上传增值税发票
 * @param parameter
 * @return {*}
 */
export function uploadInvoice (parameter) {
  return request({
    url: '/common/uploadInvoice',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: parameter,
    timeout: 5 * 60 * 1000
  })
}


/**
 * 费用申请撤回
 * @param parameter
 * @return {*}
 */
export function revoke (parameter) {
  return request({
    url: '/v2/boss/project/apply/revoke',
    method: 'get',
    params: parameter
  })
}

export function getOriginFeeApplyInfo (parameter) {
  return request({
    url: '/v2/boss/project/apply/getOriginFeeApplyInfo',
    method: 'post',
    data: parameter
  })
}

export function closeApply (parameter) {
  return request({
    url: '/v2/boss/project/apply/close',
    method: 'post',
    data: parameter
  })
}

export function listApply (parameter) {
  return request({
    url: '/boss/busNumber/list',
    method: 'post',
    data: parameter
  })
}
